import { View } from "../../../mvc/core/View";
import { ILayOut } from "../../../../modules/interfaces/ILayOut";
import { LayerManager } from "../../manager/LayerManager";
import { ObjCreate } from "../common/ObjCreate";
import { ResFileConst } from "../../resource/ResFileConst";
import { Dispatcher } from "../../../mvc/core/Dispatcher";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { Global } from "../../../../com/gengine/global/Global";
import { GLoadedButton } from "../../../../com/mui/controls/GLoadedButton";
import { SecTimerView } from "../common/SecTimerView";
//class PeaceFieldIconView
    
    export  class PeaceFieldIconView extends View implements ILayOut
    {
        constructor()
        {
            super();
            this.layer = LayerManager.rightTopUILayer;
            this.create();
            this.resetPosition();
            return;
        }

        /* internal  */create(): void
        {
            this._btnPeaceField = ObjCreate.createGLoadedButton(ResFileConst.PeaceFieldIcon, 0, 0, 50, 50, this);
            this._btnPeaceField.addEventListener(flash.events.MouseEvent.CLICK, this.onPeaceFieldHandler);
            return;
        }

        /* internal  */onPeaceFieldHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.PeaceFieldShowEnterPanel));
            return;
        }

        public resetPosition(): void
        {
            this.x = Global.stage.stageWidth - 415;
            this.y = 10;
            return;
        }

        /* internal */ /* var */_btnPeaceField: GLoadedButton;

        /* internal */ /* var */_tfLeftTime: SecTimerView;
    }
